package model
import (
	"fmt"
)

type person struct{
	Name string 
	age int 
	salary float64
}

func NewPerson(name string)*person{
	return &person{
		Name:name,
		age:0,
		salary:0.0,
	}
}

func (p *person)SetAge(age int){

	if age>0&&age<=150{
		p.age = age 
	}else{
		fmt.Println("age range error")
	}
}

func (p*person)GetAge()(int){
	return p.age 
}

func (p*person)SetSalary(salary float64){
	
	if salary>2000&&salary<30000{
		p.salary=salary 
	}else{
		fmt.Println("salary range error")
	}
}

func (p*person)GetSalary()float64{
	return p.salary
}